set(MODULE downlink)

# find_package(MbedTLS)
# find_package(OpenSSL)
# find_package(jsoncpp)

# message("mbedtls: ${MbedTLS_DIR}, ${OpenSSL_INCLUDES}, ${jsoncpp_LIBS}")


aux_source_directory(./ SRC)
aux_source_directory(tcp SRC)
aux_source_directory(serial SRC)
add_library(${MODULE} ${SRC})

if (PROJECT_ENABLE_TEST)
    add_subdirectory(test)
endif()

# find_path(LIBUV_INCLUDE_DIRECTORY uv.h ${PRODUCT_ROOT_DIR}/thirdparty/libuv/include NO_DEFAULT_PATH)
# find_library(LIBUV_LIBRARY uv ${LIBUV_LIBS_DIR} NO_DEFAULT_PATH)
# list(APPEND LIBUV_INCLUDE_DIRECTORY ${LIBUV_INCLUDE_DIR})
# message("LIBUV_INCLUDE_DIRECTORY :${LIBUV_INCLUDE_DIRECTORY}")

target_link_directories(${MODULE} PUBLIC
    ${OPENSSL_LIBS_DIR}
    ${MBEDTLS_LIBS_DIR}
    ${JSONCPP_LIBS_DIR}
    ${LIBUV_LIBS_DIR})
target_link_libraries(${MODULE} dbms uv)
target_include_directories(${MODULE} PUBLIC ./
    ${JSONCPP_INCLUDE_DIR}
    ${OPENSSL_INCLUDE_DIR}
    ${MBEDTLS_INCLUDE_DIR}
    ${LIBUV_INCLUDE_DIR}
    ${PRODUCT_ROOT_DIR}/foundation/webconfig)